package au.com.shiftyjelly.pocketcasts.wear.ui.settings

import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.wear.compose.material.MaterialTheme
import androidx.wear.compose.material.Text
import au.com.shiftyjelly.pocketcasts.BuildConfig
import au.com.shiftyjelly.pocketcasts.wear.ui.component.WatchListChip
import com.google.android.horologist.compose.layout.ScalingLazyColumn
import com.google.android.horologist.compose.layout.ScreenScaffold
import com.google.android.horologist.compose.layout.rememberResponsiveColumnState
import au.com.shiftyjelly.pocketcasts.images.R as IR
import au.com.shiftyjelly.pocketcasts.localization.R as LR

object WearAboutScreen {
    const val ROUTE = "wear_about_screen"
}

@Composable
fun WearAboutScreen(
    onTermsOfServiceClick: () -> Unit,
    onPrivacyClick: () -> Unit,
    modifier: Modifier = Modifier,
) {
    val columnState = rememberResponsiveColumnState()
    ScreenScaffold(
        scrollState = columnState,
        modifier = modifier,
    ) {
        ScalingLazyColumn(
            columnState = columnState,
        ) {
            item {
                Image(
                    painter = painterResource(IR.drawable.about_logo_pocketcasts),
                    contentDescription = stringResource(LR.string.settings_app_icon),
                )
            }

            item {
                Text(
                    text = stringResource(LR.string.settings_version, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE.toString()),
                    style = MaterialTheme.typography.body1,
                    color = MaterialTheme.colors.onSecondary,
                    textAlign = TextAlign.Center,
                )
            }

            item {
                WatchListChip(
                    title = stringResource(LR.string.settings_about_terms_of_serivce),
                    onClick = onTermsOfServiceClick,
                )
            }

            item {
                WatchListChip(
                    title = stringResource(LR.string.settings_about_privacy_policy),
                    onClick = onPrivacyClick,
                )
            }
        }
    }
}
